#!/usr/bin/env python
#coding=utf-8

import torch
import torch.nn as nn
from torch.autograd import Variable
import random

class RNN(nn.Module):
    def __init__(self, input_size, hidden_size, output_size):
        super(RNN, self).__init__()
        self.hidden_size = hidden_size

        self.rnn = torch.nn.GRU(input_size, hidden_size, batch_first=True, dropout=0.1)
        self.proj = torch.nn.Linear(hidden_size, output_size)

    def forward(self, input_, hidden):
        batch = input_.size(0)
        out, h = self.rnn(input_, hidden)
        out = self.proj(out)
        return out, h


    def initHidden(self):
        return Variable(torch.zeros(1, self.hidden_size))
